@extends('admin.main')
@section('content')
    <div class="daohang">
        <ul>
            <li>
                <button type="button" class="am-btn am-btn-default am-radius am-btn-xs"> 优惠券管理</button>
            </li>
        </ul>
    </div>
    <div class="admin-biaogelist">

        <div class="listbiaoti am-cf">
            <ul class="am-icon-flag on"> 订单列表</ul>

            <dl class="am-icon-home" style="float: right;"> 当前位置： 首页 > <a href="#">订单列表</a></dl>

        </div>

        <div class="am-btn-toolbars am-btn-toolbar am-kg">
            <ul>
                <form action="{{urlAdmin('appointment','getIndex')}}" method="get">
                <li><input type="text" class="am-form-field am-input-sm am-input-xm" name="keywords" placeholder="关键词搜索" /></li>
                <li><button type="submit" class="am-btn am-radius am-btn-xs am-btn-success" style="margin-top: -1px;">搜索</button></li>
                </form>
            </ul>
        </div>

        <div class="am-tabs am-margin" data-am-tabs>
            <ul class="am-tabs-nav am-nav am-nav-tabs">
                <li @if(isset($_GET['status']) && $_GET['status'] == 0)class="am-active"
                    @endif onclick="javascript:window.location.href='{{urlAdmin('appointment','getIndex',['status'=>0])}}'">
                    <a href="">待支付</a></li>
                <li @if(isset($_GET['status']) && $_GET['status'] == 1)class="am-active"
                    @endif onclick="javascript:window.location.href='{{urlAdmin('appointment','getIndex',['status'=>1])}}'">
                    <a href="">待就诊</a></li>
                <li @if(isset($_GET['status']) && $_GET['status'] == 2)class="am-active"
                    @endif onclick="javascript:window.location.href='{{urlAdmin('appointment','getIndex',['status'=>2])}}'">
                    <a href="">待评价</a></li>
                <li @if(isset($_GET['status']) && $_GET['status'] == 3)class="am-active"
                    @endif onclick="javascript:window.location.href='{{urlAdmin('appointment','getIndex',['status'=>3])}}'">
                    <a href="">已完成</a></li>
            </ul>
            <div class="am-tabs-bd">
                <form class="am-form am-g">
                    <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
                        <thead>
                        <tr class="am-success">
                            <th class="table-id">ID</th>
                            <th class="table-title">预约医师</th>
                            <th class="table-type">科室</th>
                            <th class="table-author">就诊人</th>
                            <th class="table-author">支付金额</th>
                            <th class="table-author">会员等级</th>
                            @if($_GET['status']!=0)
                            <th class="table-author">支付方式</th>
                            @endif
                            <th class="table-date am-hide-sm-only">创建时间</th>
                            <th class="table-author">预约时间</th>
                            <th width="163px" class="table-set">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(!empty($res['data']['data']))
                            @foreach($res['data']['data'] as $v)
                                <tr id="tr_{{$v['id']}}">
                                    <td>{{$v['id']}}</td>
                                    <td>{{$v['doctor_name']}}</td>
                                    <td>{{$v['depart_name']}}</td>
                                    <td class="am-hide-sm-only">{{$v['name']}}</td>
                                    <td>{{$v['register_price']}}</td>
                                    <th>@if($v['card']['level']==6) 家庭会员 @endif @if($v['card']['level']==1) 普通客户 @endif @if($v['card']['level']==2) 普通会员 @endif</th>
                                    @if($_GET['status']!=0)
                                    <th class="table-author">@if($v['pay_way']==1) 就诊卡 @endif @if($v['pay_way']==2) 微信支付 @endif @if($v['pay_way']==3) 银联 @endif</th>
                                    @endif
                                    <td>{{date('Y-m-d H:i:s',$v['addtime'])}}</td>
                                    <td>{{date('Y-m-d H:i:s',$v['mark_time'])}}</td>
                                    <td width="20%"><a href="javascript:void(0)" onclick="del({{$v['id']}})"
                                                                             class="abtn ff6600">删除</a></td>
                                </tr>
                            @endforeach
                        @else
                            <tr>
                                <td colspan="8" style="text-align: center"><span>暂无数据~</span></td>

                            </tr>
                        @endif
                        </tbody>
                    </table>
                        <ul class="am-pagination am-fr">
                            @if(isset($res['data']['prev_page_url']))
                                <li><a href="$res['data']['prev_page_url']">«</a></li>
                            @endif
                            @foreach($res['data']['pageNoList'] as $v)
                                @if($res['data']['current_page']==$v)
                                    <li class="am-active"><a
                                                href="{{urlAdmin('appointment','getIndex')}}?page={{$v}}@if(isset($_GET['status']))&type={{$_GET['status']}}@endif">{{$v}}</a>
                                    </li>
                                @else
                                    <li>
                                        <a href="{{urlAdmin('appointment','getIndex')}}?page={{$v}}@if(isset($_GET['status']))&type={{$_GET['status']}}@endif">{{$v}}</a>
                                    </li>
                                @endif
                            @endforeach
                                @if(isset($res['data']['next_page_url']))
                                    <li><a href="$res['data']['next_page_url']">»</a></li>
                                @endif
                        </ul>
                    @include('admin.footer')
                    @section('css')
                        <link type="text/css" src="/assets/layer/skin/default/layer.css"/>
                    @endsection
                    @section('js')
                        <script type="text/javascript" src="/assets/layer/layer.js"></script>
                    @endsection
                    @section('script')
                        <script>
                            function del(id) {
                                layer.confirm('您确定要删除吗？', {
                                    btn: ['确定', '取消'] //按钮
                                }, function () {
                                    $.ajax({
                                        type: "get",
                                        url: "{{urlAdmin('appointment','getDel')}}?id=" + id,
                                        dataType: "json",
                                        success: function (res) {
                                            if (res['state'] == 1) {
                                                layer.msg('删除成功', {icon: 6});
                                                $('#tr_'+id).hide();
                                            } else {
                                                layer.msg('删除失败', {icon: 5});
                                            }
                                        }
                                    })

                                });
                            }
                        </script>
                    @endsection
                </form>
            </div>
        </div>
    </div>
    </div>
@endsection